import request from '@/utils/request'


export function getSpaces(homeId) {
  return request({
    url: '/space/spaces/'+homeId,
    method: 'get'
  })
}

export function addSpace(data) {
  return request({
    url: '/space/addSpace',
    method: 'post',
	params: data
  })
}

export function saveSpace(data) {
  return request({
    url: '/space/saveSpace/'+data.id,
    method: 'post',
	params: data
  })
}

export function delSpace(id) {
  return request({
    url: '/space/delSpace/'+id,
    method: 'delete'
  })
}

export function getCurrentHome() {
  return request({
    url: '/space/currentHome',
    method: 'get'
  })
}

export function changCurrentHome(data) {
  return request({
    url: '/space/changCurrentHome',
    method: 'post',
	params: data
  })
}

export function getUserHomes() {
  return request({
    url: '/space/getUserHomes',
    method: 'get'
  })
}

export function getDevicesBySpaceId(spaceId) {
  return request({
    url: '/space//myDevices/'+spaceId,
    method: 'get'
  })
}
